package com.xuhuan.example.example025;

import com.xuhuan.example.util.ExampleArrayUtils;

/**
 * @author: 徐欢
 * @date: 2023/11/12 19:29
 * @description:
 */
public class Example025 {

    public static void main(String[] args) {
        int num = 10;
        int[][] array = new int[num][];
        for (int i = 0; i < array.length; i++) {
            array[i] = new int[i + 1];
            for (int j = 0; j <= i; j++) {
                if (i == 0 || j == 0 || i == j) {
                    array[i][j] = 1;
                } else {
                    array[i][j] = array[i - 1][j] + array[i - 1][j - 1];
                }
            }
        }
        System.out.println("---------杨辉三角----------");
        ExampleArrayUtils.printArray(array);
    }

}
